package com.zero.xiaodai.utils;

import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.ocr.v20181119.OcrClient;
import com.tencentcloudapi.ocr.v20181119.models.GeneralAccurateOCRRequest;
import com.tencentcloudapi.ocr.v20181119.models.GeneralAccurateOCRResponse;
import com.tencentcloudapi.ocr.v20181119.models.GeneralBasicOCRRequest;
import com.tencentcloudapi.ocr.v20181119.models.GeneralBasicOCRResponse;

public class TencentOcr {
	
	public static void main(String[] args) {
		try{
            // 实例化一个认证对象，入参需要传入腾讯云账户secretId，secretKey
            Credential cred = new Credential("AKIDuIckdL59KMCKCst2M2ZszvlXFn8GOKh0", "EE3fJkEUeZQIwNYWEk0HMEubtwmLfx3w");
            
            
            
            HttpProfile httpProfile = new HttpProfile();
            httpProfile.setReqMethod("POST"); 
            httpProfile.setConnTimeout(60); 
            httpProfile.setEndpoint("ocr.tencentcloudapi.com"); 
            ClientProfile clientProfile = new ClientProfile();
            clientProfile.setUnsignedPayload(true);
            clientProfile.setHttpProfile(httpProfile);
            

            OcrClient ocrClient=new OcrClient(cred, "ap-shanghai", clientProfile);
            GeneralAccurateOCRRequest req=new GeneralAccurateOCRRequest();
            //req.setImageBase64("");
            req.setImageUrl("http://61.130.108.186:22224/common/downloadFile?fileName=/file/e70a6b91-39a0-43e5-b04e-a819e07a5e97.png");
            GeneralAccurateOCRResponse res=ocrClient.GeneralAccurateOCR(req);
            
            
            System.out.println(GeneralAccurateOCRResponse.toJsonString(res));
            //System.out.println(res.getRequestId());
        } catch (TencentCloudSDKException e) {
                System.out.println(e.toString());
        }
	}

}
